Posts

Post marked as solved
9 Replies
thanks..I will get back to you when I work through this. Toda shalom.
Post marked as solved
9 Replies
Ok Claude hang with meimport UIKitstruct QA { var question: String var correctAnswer: String}(Created a struct which can have a long list of variables)....checkvar allQA: [QA](Created array to hold all QA struct variables) Checklet q1 = QA(question:"In the preparaton of a rental agreement, the landlord and tenant can agree to include terms prohibited by law?", correctAnswer: "False" )let q2 = QA(question:"Unless the rental agreement says differently, the tenant shal pay fair market rent for the use of the dwelling unit as determined by the landlord.", correctAnswer: "True")(Creating unchangable arrays which hold differing QA structs)....not sure why created the allQA:[QA] could we have just went to creating questions then put them in an array like the next step?allQA = [q1,q2]OK I think I just figured out we just intialize a variable holding a struct which is an array in the step above....we are now placing the variables inside the arrary...think i got that now....func getQuestion() -> QA { return allQA.randomElement() ??} Expected expression after operatorNow we are creating a function called getQuestion(). getQuestion() returns a QA structinside the fuction it will pic a random element insided the allQA array.....why does it require a () at the end and ?? two question marks...starting to make a bit more sense though. Thanks for your help.and also i get an Expected expression after operator error on the last line?
Post marked as solved
9 Replies
Now i need a way to compare the strings from the true and false radio buttons and add a counter. could you help me out. Thanks.
Post marked as solved
9 Replies
import UIKitstruct QA { var question: String var correctAnswer: String}var allQA: [QA]let q1 = QA(question:"In the preparaton of a rental agreement, the landlord and tenant can agree to include terms prohibited by law?", correctAnswer: "False" )let q2 = QA(question:"Unless the rental agreement says differently, the tenant shal pay fair market rent for the use of the dwelling unit as determined by the landlord.", correctAnswer: "True")allQA = [q1,q2]func getQuestion() -> QA( return allQA.randomElement())I AM GETTING 2 ERRORS ON THE FUNC1. Consecutive statements on a line must be separated by ';'2. Expected expression in list of expressionsThanks for helping me get the struct down correctly....coming together...shalom
Post marked as solved
9 Replies
Claude can you help me through my logical thinking process... this is what I seestruct QA { (I am building a struct called QA that will hold data) var question: String (question will be a string) var correctAnswer: String (answer will be a string) var phonytAnswers: [String] = ["", "", ""] (SO IS THIS an Array or wrong answer // The ones to use in buttons, along with the correct one}var allQA: [QA] (OK HERE IS WHERE I AM GETTING LOST----- We just made a variable allQA which is an array? That holds Question, Correct Answer, phony answers?]I really get lost past this concept.... I know you are right in your approach not quesitoning that as I am a pea compared to you, but I just don't know what we really created there....I am going to run the dump(allQA) to see what prints out i guess.Thanks for hangin with me man. I am really enjoying this process of learning to program. Shalom.
Post not yet marked as solved
3 Replies
Thanks for teaching me the proper terminology. Shalom.